/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Game={
    create:function () {
        var game={};
       game.ui=new PIXI.DisplayObjectContainer();
       var page0=Page0.create();
       var page1=Page1.create();
        game.ui.addChild(page0.ui);
        page0.In();

        document.addEventListener('Game_PageIn',pageInHandler)
        function pageInHandler(e)
        {
            if(e.detail=='0')
            {
                game.ui.addChild(page1.ui);
                page1.In();
            }

        }
        return game;
    }

}

var ripples=[];
var rippleTarget;
function Ripple(x, y,_rippleTarget) {
    // sprite
    rippleTarget=_rippleTarget;
    this.sprite = new PIXI.Sprite(resource["assets/images/2yYayZk.png"].texture);
    this.sprite.texture.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;
    // var texture2 = PIXI.Texture.fromImage("http://i.imgur.com/2yYayZk.png");
    this.sprite.anchor.set(0.5);
    this.sprite.position.set(x, y);
    this.sprite.scale.set(0.7);
    rippleTarget.addChild(this.sprite);
    // filter
    this.filter = new PIXI.filters.DisplacementFilter(this.sprite);
}
Ripple.prototype.update = function() {
    this.sprite.x += 1.1;
    this.sprite.y += 1.1;
}


var ticker=PIXI.ticker.shared;
ticker.add(function (time) {


    for(var i=0; i<ripples.length; i++) {
        ripples[i].update();
    }
});